package com.cy.pj.sys.pojo;

import lombok.Data;

import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@NoArgsConstructor
@Data
public class PageObject<T> implements Serializable {
    //   当前页码数
    private Integer pageCurrent;
    //   记录数
    private Integer rowCount;
    //   页面大小--最多记录数
    private Integer pageSize;
    //   当前页记录
    private List<T> records;
    //   总页数
    private Integer pageCount;

    public PageObject(Integer pageCurrent, Integer rowCount, Integer pageSize, List<T> records) {
        this.pageCurrent = pageCurrent;
        this.rowCount = rowCount;
        this.pageSize = pageSize;
        this.records = records;
        this.pageCount = rowCount / pageSize;
        if (rowCount % pageSize != 0) this.pageCount++;
    }
}
